var ejsExcel = require("ejsexcel");
var fs = require("fs");
var path = require("path");


module.exports = {
  process: function(data,suc=()=>{

  },fail=()=>{
      throw new Error('UnHandled Excel process error');
  }){
    let fileUrl = path.join(__dirname,"../../assets/templates/testAttendance.xlsx");
    fs.readFile(fileUrl,(err,excelFile)=>{
        if(err){
            fail();
            return;
        }
        ejsExcel.renderExcelCb(excelFile, data, function(err,exlBuf2){
            if(err) {
                fail();
                return;
            }
            suc(new Buffer(exlBuf2).toString('base64'));
        });
    });
  }
}
